#ifndef __xSDK_H__
#define __xSDK_H__

#if !LINUX_SYSTEM
	#error only linux system supported
#endif

#define OutputDebugString(str) printf(str)
#define _CrtDbgReport(reportType, filename, linenumber, moduleName, format) 1
#define _CrtDbgBreak assert

#pragma warning( push )
#pragma warning(disable : 4035)
inline UINT64 etlGetCPUTickCount()
{
	return clock();
}
#pragma warning( pop ) 

inline DWORD etlGetTickCount()
{
	struct timeval timeThis;
	gettimeofday(&timeThis, NULL);
	return timeThis.tv_sec * 1000 + timeThis.tv_usec;
}

inline void etlGetLocalTime(SYSTEMTIME* lpTime)
{
	chASSERT(lpTime != NULL);
	struct timeval timeThis;
	gettimeofday(&timeThis, NULL);

	struct tm* pLocalTime = localtime((time_t*)&timeThis.tv_sec);
	lpTime->wYear = pLocalTime->tm_year + 1900;
	lpTime->wMonth = pLocalTime->tm_mon + 1;
	lpTime->wDay = pLocalTime->tm_wday;
	lpTime->wHour = pLocalTime->tm_hour;
	lpTime->wMinute = pLocalTime->tm_min;
	lpTime->wSecond = pLocalTime->tm_sec;
	lpTime->wDayOfWeek = pLocalTime->tm_wday;
	lpTime->wMilliseconds = timeThis.tv_usec;
}

inline BOOL etlPathFileExists(LPCTSTR lpszFileName)
{
	struct stat fileSta;
	return stat(lpszFileName, &fileSta) == 0;
}
#endif //__xSDK_H__
